<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							<input id="deptId" name="parentId" type="hidden">
							<div class="form-group" id="txtSpan">
							</div>
							<div class="form-group">
								<div class="col-sm-8" style="float:none;margin:0px auto;">
									<textarea style="height:300px;" id="value" name="value" class="form-control" placeholder="请输入文字内容"></textarea>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8" style="float:none;margin:0px auto;">
									<div  style="display:block;margin:0px auto;text-align: center;">
										<button type="button" class="btn btn-primary" style="margin-right:20px;" onclick="create()">生成二维码（不带logo）</button>
										<button type="button" class="btn btn-primary" onclick="createLogo()">生成二维码（带logo）</button>
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript">
		function create(){
			if($("#value").val()==null||$("#value").val()==''){
				layer.msg("请输入文字内容");
				return ;
			}
			$.ajax({
				type: "POST",
				data: {
					value:$("#value").val()
				}, // 你的formid
				url: "/common/erCodeFactory/create",
				async : true,
				success: function (data) {
					if (data.code == 0) {
						openErCode();
					} else {
						layer.alert(data.msg);
					}

				}
			});
		}
		function createLogo(){
			if($("#value").val()==null||$("#value").val()==''){
				layer.msg("请输入文字内容");
				return ;
			}
			$.ajax({
				type: "POST",
				data: {
					value:$("#value").val()
				}, // 你的formid
				url: "/common/erCodeFactory/createLogo",
				async : true,
				success: function (data) {
					if (data.code == 0) {
						openErCode();
					} else {
						layer.alert(data.msg);
					}

				}
			});
		}
		function openErCode() {
			layer.open({
				type : 2,
				title : '二维码',
				maxmin : true,
				shadeClose : false, // 点击遮罩关闭层
				area : [ '450px', '485px' ],
				content : '/common/erCodeFactory/openErCode'  // iframe的url
			});
		}
	</script>
</body>
</html>
